package mathematics;
import java.math.BigDecimal;
import java.math.RoundingMode;

public class BigDecimalDemo {
    public static void main(String[] args) {
        double a = 0.123456789;
        double b = 9.87654321;
        BigDecimal c = new BigDecimal(a);
        BigDecimal d = BigDecimal.valueOf(b);
        BigDecimal e = c.multiply(d);
        System.out.println(e);
        // e除以小数，商的小数位最多保留9位，最后一位四舍五入
        BigDecimal f = e.divide(BigDecimal.valueOf(0.265913784), 9, RoundingMode.HALF_UP);
        System.out.println(f);
    }
}
